package com.gxy.learn.design.model.create.singleton;

/**
 * @description: 单例 懒汉式 双重检查锁方式
 * @author: gaoxueyong
 * @Date: 2022/11/6 17:07
 */
public class SingletonSluggardDcl {
    private SingletonSluggardDcl() {
    }

    private volatile static SingletonSluggardDcl instance;

    public static SingletonSluggardDcl getInstance() {
        if (null == instance) {
            synchronized (SingletonSluggardDcl.class) {
                if (null == instance) {
                    instance = new SingletonSluggardDcl();
                }
            }
        }
        return instance;
    }
}
